package geektime.spring.springbucks.mapper;

import geektime.spring.springbucks.model.Coffee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;

import java.util.List;
import java.util.Map;

@Mapper
public interface CoffeeMapper {
    @Select("select * from t_coffee where name=#{name}")
    Coffee findOneCoffee(@Param("name") String  name);

    @Select("select * from t_coffee order by id")
    List<Coffee> findAllWithRowBounds(RowBounds rowBounds);

    @Select("select * from t_coffee order by id")
    List<Coffee> findAllWithParam(@Param("pageNum") int pageNum,
                                  @Param("pageSize") int pageSize);

    @Select(" select * from t_coffee where  id=${name}   order by id")
    List<Coffee> findAllWithRowBounds2(@Param("name") String name);

    @Select("select * from ${name} where id in (1,2,3,4,5,6,7,8,9,10) order by id")
    List<Coffee> findAllWithRowBounds3(@Param("name") String name);
}
